d %>%
select(Group, matches("wb_")) %>%
na.omit() %>%
melt(id.vars = "Group") %>%
ggplot(aes(color = Group, group = Group)) +
geom_boxplot(aes(x = Group, y = value), size=1.2) +
facet_wrap( . ~ variable, scales = "free_y") +
theme_classic() +
scale_colour_manual(values=c("blue", "red")) +
scale_x_discrete(labels = c("YA", "OA")) +
ggtitle("Whole Brain")
d %>%
select(Group, matches("dmn_")) %>%
na.omit() %>%
melt(id.vars = "Group") %>%
ggplot(aes(color = Group, group = Group)) +
geom_boxplot(aes(x = Group, y = value), size=1.2) +
facet_wrap( . ~ variable, scales = "free_y") +
theme_classic() +
scale_colour_manual(values=c("blue", "red")) +
scale_x_discrete(labels = c("YA", "OA")) +
ggtitle("Default Mode Network")
d %>%
select(Group, matches("fpn_")) %>%
na.omit() %>%
melt(id.vars = "Group") %>%
ggplot(aes(color = Group, group = Group)) +
geom_boxplot(aes(x = Group, y = value), size=1.2) +
facet_wrap( . ~ variable, scales = "free_y") +
theme_classic() +
scale_colour_manual(values=c("blue", "red")) +
scale_x_discrete(labels = c("YA", "OA")) +
ggtitle("Control Network")
t <- t.test(wb_participation_x ~ Group, data = d) ##
t
##
## Welch Two Sample t-test
##
## data: wb_participation_x by Group
## t = -2.9188, df = 90.959, p-value = 0.004428
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.033410434 -0.006351073
## sample estimates:
## mean in group Young Adults mean in group Older Adults
## 0.5356950 0.5555758
ggplot(d, aes(x = Group, y = wb_participation_x, color = Group)) +
geom_boxplot() +
theme_classic() +
scale_colour_manual(values=c("blue", "red")) +
scale_x_discrete(labels=c("YA", "OA")) +
xlab("Age Group") + ylab("Participation \n Coefficient") +
labs(caption = (paste("t = ", round(t$statistic, 3), "p = ", round(t$p.value, 3))))
## Warning: Removed 48 rows containing non-finite values (stat_boxplot).
t <- t.test(wb_efficiency_x ~ Group, data = d) ##
t
##
## Welch Two Sample t-test
##
## data: wb_efficiency_x by Group
## t = 3.8114, df = 92.845, p-value = 0.0002483
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.1304413 0.4142297
## sample estimates:
## mean in group Young Adults mean in group Older Adults
## 3.141530 2.869194
ggplot(d, aes(x = Group, y = wb_efficiency_x, color = Group)) +
geom_boxplot(size = 1.2) +
theme_classic() +
scale_colour_manual(values=c("blue", "red")) +
scale_x_discrete(labels=c("YA", "OA")) +
xlab("Age Group") + ylab("Global \n Efficiency") +
theme(axis.text=element_text(size=12), plot.caption = element_text(size = 12)) +
labs(caption = (paste("t = ", round(t$statistic, 3), "p = ", round(t$p.value, 3))))
## Warning: Removed 48 rows containing non-finite values (stat_boxplot).
t <- t.test(dmn_efficiency_x ~ Group, data = d) ##
t
##
## Welch Two Sample t-test
##
## data: dmn_efficiency_x by Group
## t = 5.8913, df = 86.006, p-value = 7.268e-08
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.2595411 0.5239029
## sample estimates:
## mean in group Young Adults mean in group Older Adults
## 3.244527 2.852805
ggplot(d, aes(x = Group, y = dmn_efficiency_x, color = Group)) +
geom_boxplot(size = 1.2) +
theme_classic() +
scale_colour_manual(values=c("blue", "red")) +
scale_x_discrete(labels=c("YA", "OA")) +
xlab("Age Group") + ylab("Global \n Efficiency") +
theme(axis.text=element_text(size=12), plot.caption = element_text(size = 12)) +
labs(caption = (paste("t = ", round(t$statistic, 3), "p = ", round(t$p.value, 3))))
## Warning: Removed 48 rows containing non-finite values (stat_boxplot).
t <- t.test(dmn_modularity_x ~ Group, data = d) ##
t
##
## Welch Two Sample t-test
##
## data: dmn_modularity_x by Group
## t = 2.7118, df = 87.872, p-value = 0.008049
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.009109265 0.059086430
## sample estimates:
## mean in group Young Adults mean in group Older Adults
## 0.3565410 0.3224431
ggplot(d, aes(x = Group, y = dmn_modularity_x, color = Group)) +
geom_boxplot(size = 1.2) +
theme_classic() +
scale_colour_manual(values=c("blue", "red")) +
scale_x_discrete(labels=c("YA", "OA")) +
xlab("Age Group") + ylab("Global \n Efficiency") +
theme(axis.text=element_text(size=12), plot.caption = element_text(size = 12)) +
labs(caption = (paste("t = ", round(t$statistic, 3), "p = ", round(t$p.value, 3))))
## Warning: Removed 48 rows containing non-finite values (stat_boxplot).
t <- t.test(fpn_participation_x ~ Group, data = d) ##
t
##
## Welch Two Sample t-test
##
## data: fpn_participation_x by Group
## t = -2.5097, df = 87.077, p-value = 0.01393
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.062979928 -0.007312262
## sample estimates:
## mean in group Young Adults mean in group Older Adults
## 0.5996818 0.6348279
ggplot(d, aes(x = Group, y = fpn_participation_x, color = Group)) +
geom_boxplot(size = 1.2) +
theme_classic() +
scale_colour_manual(values=c("blue", "red")) +
scale_x_discrete(labels=c("YA", "OA")) +
xlab("Age Group") + ylab("Global \n Efficiency") +
theme(axis.text=element_text(size=12), plot.caption = element_text(size = 12)) +
labs(caption = (paste("t = ", round(t$statistic, 3), "p = ", round(t$p.value, 3))))
## Warning: Removed 48 rows containing non-finite values (stat_boxplot).
t <- t.test(fpn_betweenness_x ~ Group, data = d) ##
t
##
## Welch Two Sample t-test
##
## data: fpn_betweenness_x by Group
## t = -2.5874, df = 91.65, p-value = 0.01124
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -107.29739 -14.10449
## sample estimates:
## mean in group Young Adults mean in group Older Adults
## 543.9900 604.6909
ggplot(d, aes(x = Group, y = fpn_betweenness_x, color = Group)) +
geom_boxplot(size = 1.2) +
theme_classic() +
scale_colour_manual(values=c("blue", "red")) +
scale_x_discrete(labels=c("YA", "OA")) +
xlab("Age Group") + ylab("Global \n Efficiency") +
theme(axis.text=element_text(size=12), plot.caption = element_text(size = 12)) +
labs(caption = (paste("t = ", round(t$statistic, 3), "p = ", round(t$p.value, 3))))
## Warning: Removed 48 rows containing non-finite values (stat_boxplot).
alpha = 0.05
oa_cor <- select(oa_data, age, IS:RA, actquot, actamp:fact, matches("zscore|z_score|time_trails"))
oa_cor <- oa_cor[complete.cases(oa_cor), ]
oa_mat <- cor(oa_cor)
oa_res <- cor.mtest(oa_mat, conf.level = (1-alpha))
corrplot(oa_mat, p.mat = oa_res$p, sig.level = alpha, insig = "blank", type = "upper")
alpha = 0.05
oa_cor <- select(oa_data, age, sleep_time, onset_latency, sleep_efficiency, matches("zscore|z_score|time_trails"))
oa_cor <- oa_cor[complete.cases(oa_cor), ]
oa_mat <- cor(oa_cor)
oa_res <- cor.mtest(oa_mat, conf.level = (1-alpha))
corrplot(oa_mat, p.mat = oa_res$p, sig.level = alpha, insig = "blank", type = "upper")
oa_data %>%
select(age, IS, matches("zscore|z_score")) %>%
melt(id.vars = "IS") %>%
ggplot() +
theme_minimal() +
geom_point(aes(x = IS, y = value)) +
facet_wrap (. ~ variable, scales = "free_y") +
ggtitle("IS and Neuropsych Measures")
## Warning: Removed 373 rows containing missing values (geom_point).
oa_data %>%
select(age, fact, matches("zscore|z_score")) %>%
melt(id.vars = "fact") %>%
ggplot() +
theme_minimal() +
geom_point(aes(x = fact, y = value)) +
facet_wrap (. ~ variable, scales = "free_y") +
ggtitle("F-statistic and Neuropsych Measures")
## Warning: Removed 364 rows containing missing values (geom_point).
oa_data %>%
select(age, RA, matches("zscore|z_score")) %>%
melt(id.vars = "RA") %>%
ggplot() +
theme_minimal() +
geom_point(aes(x = RA, y = value)) +
facet_wrap (. ~ variable, scales = "free_y") +
ggtitle("RA and Neuropsych Measures")
## Warning: Removed 373 rows containing missing values (geom_point).
oa_data %>%
select(age, IV, matches("zscore|z_score")) %>%
melt(id.vars = "IV") %>%
ggplot() +
theme_minimal() +
geom_point(aes(x = IV, y = value)) +
facet_wrap (. ~ variable, scales = "free_y") +
ggtitle("IV and Neuropsych Measures")
## Warning: Removed 373 rows containing missing values (geom_point).
oa_data %>%
select(age, sleep_time, matches("zscore|z_score")) %>%
melt(id.vars = "sleep_time") %>%
ggplot() +
theme_minimal() +
geom_point(aes(x = sleep_time, y = value)) +
facet_wrap (. ~ variable, scales = "free_y") +
ggtitle("Sleep Time and Neuropsych Measures")
## Warning: Removed 260 rows containing missing values (geom_point).
oa_data %>%
select(age, sleep_efficiency, matches("zscore|z_score")) %>%
melt(id.vars = "sleep_efficiency") %>%
ggplot() +
theme_minimal() +
geom_point(aes(x = sleep_efficiency, y = value)) +
facet_wrap (. ~ variable, scales = "free_y") +
ggtitle("Sleep Efficiency and Neuropsych Measures")
## Warning: Removed 260 rows containing missing values (geom_point).
Trails B
alpha = 0.05
oa_cor <- select(oa_data, age, IS:RA, actquot, actamp:fact, sleep_time, sleep_efficiency, trails_b_z_score)
oa_cor <- oa_cor[complete.cases(oa_cor), ]
oa_mat <- cor(oa_cor)
oa_res <- cor.mtest(oa_mat, conf.level = (1-alpha))
corrplot(oa_mat, p.mat = oa_res$p, sig.level = alpha, insig = "blank", type = "upper")
oa_data$TMT <- ifelse(oa_data$trails_b_z_score < median(oa_data$trails_b_z_score, na.rm = TRUE), "Low", "High")
ya_data$TMT <- ifelse(ya_data$trails_b_z_score < median(ya_data$trails_b_z_score, na.rm = TRUE), "Low", "High")
alpha = 0.05
oa_data %>%
na.omit(TMT) %>%
select(age, IS:RA, actamp, actquot, fact, actalph, TMT) %>%
melt(id.vars = "TMT") %>%
ggplot() +
theme_minimal() +
geom_boxplot(aes(x = TMT, y = value)) +
facet_wrap(. ~ variable, scales = "free_y") +
ggtitle("Rest-activity measures by TMT performance")
Out of curiosity from DTI…
oa_data %>%
select(age, actalph, matches("zscore|z_score|time_trails")) %>%
melt(id.vars = "actalph") %>%
ggplot() +
theme_minimal() +
geom_point(aes(x = actalph, y = value)) +
facet_wrap(. ~ variable, scales = "free_y") +
ggtitle("actalph and Neuropsych Measures")
## Warning: Removed 412 rows containing missing values (geom_point).
alpha = 0.05
ya_cor <- select(ya_data, age, IS:RA, actquot, actamp:fact, vc_zscore, ds_zscore, trails_a_z_score, trails_b_z_score)
ya_cor <- ya_cor[complete.cases(ya_cor), ]
ya_mat <- cor(ya_cor)
ya_res <- cor.mtest(ya_mat, conf.level = (1-alpha))
corrplot(ya_mat, p.mat = ya_res$p, sig.level = alpha, insig = "blank", type = "upper")
alpha = 0.05
ya_cor <- select(ya_data, age, sleep_time, onset_latency, sleep_efficiency, vc_zscore, ds_zscore, trails_a_z_score, trails_b_z_score)
ya_cor <- ya_cor[complete.cases(ya_cor), ]
ya_mat <- cor(ya_cor)
ya_res <- cor.mtest(ya_mat, conf.level = (1-alpha))
corrplot(ya_mat, p.mat = ya_res$p, sig.level = alpha, insig = "blank", type = "upper")
summary(lm(trails_b_z_score ~ sleep_efficiency, data = ya_data)) # p = 0.0468, B < 0 ?
##
## Call:
## lm(formula = trails_b_z_score ~ sleep_efficiency, data = ya_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.8328 -0.5065 0.1738 0.7276 1.9377
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.44600 2.34822 1.893 0.0631 .
## sleep_efficiency -0.05812 0.02863 -2.030 0.0468 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.295 on 60 degrees of freedom
## (12 observations deleted due to missingness)
## Multiple R-squared: 0.06428, Adjusted R-squared: 0.04868
## F-statistic: 4.121 on 1 and 60 DF, p-value: 0.04678
summary(lm(trails_b_z_score ~ Group*sleep_efficiency, data = d)) # *
##
## Call:
## lm(formula = trails_b_z_score ~ Group * sleep_efficiency, data = d)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.8328 -0.5304 0.2233 0.7847 2.1772
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.44600 2.38736 1.862 0.0650 .
## GroupOlder Adults -5.49393 2.84379 -1.932 0.0557 .
## sleep_efficiency -0.05812 0.02910 -1.997 0.0481 *
## GroupOlder Adults:sleep_efficiency 0.07448 0.03484 2.137 0.0346 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.317 on 121 degrees of freedom
## (18 observations deleted due to missingness)
## Multiple R-squared: 0.08085, Adjusted R-squared: 0.05806
## F-statistic: 3.548 on 3 and 121 DF, p-value: 0.01661
summary(lm(trails_b_z_score ~ sleep_time, data = ya_data)) # p = 0.0472, B < 0 ?
##
## Call:
## lm(formula = trails_b_z_score ~ sleep_time, data = ya_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.7078 -0.5046 0.1129 0.8422 1.9248
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.269246 0.796407 1.594 0.1163
## sleep_time -0.003959 0.001954 -2.026 0.0472 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.295 on 60 degrees of freedom
## (12 observations deleted due to missingness)
## Multiple R-squared: 0.06403, Adjusted R-squared: 0.04843
## F-statistic: 4.105 on 1 and 60 DF, p-value: 0.04722
summary(lm(trails_b_z_score ~ Group*sleep_time, data = d)) # .
##
## Call:
## lm(formula = trails_b_z_score ~ Group * sleep_time, data = d)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.7078 -0.5468 0.1402 0.8539 2.2785
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.269246 0.810318 1.566 0.1199
## GroupOlder Adults -1.585320 1.152574 -1.375 0.1715
## sleep_time -0.003959 0.001988 -1.991 0.0487 *
## GroupOlder Adults:sleep_time 0.005395 0.002811 1.919 0.0573 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.318 on 121 degrees of freedom
## (18 observations deleted due to missingness)
## Multiple R-squared: 0.07917, Adjusted R-squared: 0.05634
## F-statistic: 3.468 on 3 and 121 DF, p-value: 0.01839
alpha = 0.05
oa_cor <- select(oa_data, age, matches("wb_|dmn_|fpn_"),matches("zscore|z_score"))
oa_cor <- oa_cor[complete.cases(oa_cor), ]
oa_mat <- cor(oa_cor)
oa_res <- cor.mtest(oa_mat, conf.level = (1-alpha))
corrplot(oa_mat, p.mat = oa_res$p, sig.level = alpha, insig = "blank", type = "upper")
oa_data %>%
select(age, dmn_participation_x, matches("zscore|z_score")) %>%
melt(id.vars = "dmn_participation_x") %>%
ggplot() +
theme_minimal() +
geom_point(aes(x = dmn_participation_x, y = value)) +
stat_smooth(aes(x = dmn_participation_x, y = value), method = "lm") +
facet_wrap (. ~ variable, scales = "free_y") +
ggtitle("DMN Participation and Neuropsych Measures")
## Warning: Removed 527 rows containing non-finite values (stat_smooth).
## Warning: Removed 527 rows containing missing values (geom_point).
summary(lm(ds_zscore ~ dmn_participation_x, data = oa_data)) #NS
##
## Call:
## lm(formula = ds_zscore ~ dmn_participation_x, data = oa_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.42334 -0.66735 0.04663 0.73076 1.69316
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.280 1.004 2.271 0.0282 *
## dmn_participation_x -3.750 2.132 -1.759 0.0857 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.9551 on 43 degrees of freedom
## (35 observations deleted due to missingness)
## Multiple R-squared: 0.06713, Adjusted R-squared: 0.04544
## F-statistic: 3.095 on 1 and 43 DF, p-value: 0.08567
summary(lm(ds_zscore ~ Group*dmn_participation_x, data = d)) #NS
##
## Call:
## lm(formula = ds_zscore ~ Group * dmn_participation_x, data = d)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.42334 -0.66134 0.02522 0.73278 2.70366
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.1999 1.1419 -0.175 0.861
## GroupOlder Adults 2.4796 1.5919 1.558 0.123
## dmn_participation_x 1.1985 2.3979 0.500 0.618
## GroupOlder Adults:dmn_participation_x -4.9482 3.3613 -1.472 0.144
##
## Residual standard error: 1.055 on 91 degrees of freedom
## (48 observations deleted due to missingness)
## Multiple R-squared: 0.03571, Adjusted R-squared: 0.003919
## F-statistic: 1.123 on 3 and 91 DF, p-value: 0.3439
oa_data %>%
select(age, fpn_participation_x, matches("zscore|z_score")) %>%
melt(id.vars = "fpn_participation_x") %>%
ggplot() +
theme_minimal() +
geom_point(aes(x = fpn_participation_x, y = value)) +
stat_smooth(aes(x = fpn_participation_x, y = value), method = "lm") +
facet_wrap (. ~ variable, scales = "free_y") +
ggtitle("FPN Participation and Neuropsych Measures")
## Warning: Removed 527 rows containing non-finite values (stat_smooth).
## Warning: Removed 527 rows containing missing values (geom_point).
summary(lm(trails_b_z_score ~ fpn_participation_x, data = oa_data)) # p = 0.0569
##
## Call:
## lm(formula = trails_b_z_score ~ fpn_participation_x, data = oa_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.32631 -0.95633 0.07623 0.83106 2.48105
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -4.109 2.158 -1.904 0.0636 .
## fpn_participation_x 7.106 3.387 2.098 0.0418 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.236 on 43 degrees of freedom
## (35 observations deleted due to missingness)
## Multiple R-squared: 0.09286, Adjusted R-squared: 0.07176
## F-statistic: 4.401 on 1 and 43 DF, p-value: 0.04182
alpha = 0.05
ya_cor <- select(ya_data, age, matches("wb_|dmn_|fpn_"), vc_zscore, ds_zscore, trails_a_z_score, trails_b_z_score)
ya_cor <- ya_cor[complete.cases(ya_cor), ]
ya_mat <- cor(ya_cor)
ya_res <- cor.mtest(ya_mat, conf.level = (1-alpha))
corrplot(ya_mat, p.mat = ya_res$p, sig.level = alpha, insig = "blank", type = "upper")
ya_data %>%
select(age, fpn_participation_x, vc_zscore, ds_zscore, trails_a_z_score, trails_b_z_score) %>%
melt(id.vars = "fpn_participation_x") %>%
ggplot() +
theme_minimal() +
geom_point(aes(x = fpn_participation_x, y = value)) +
facet_wrap (. ~ variable, scales = "free_y") +
ggtitle("FPN Participation and Neuropsych Measures")
## Warning: Removed 122 rows containing missing values (geom_point).
summary(lm(trails_b_z_score ~ fpn_participation_x, data = ya_data)) #NS
##
## Call:
## lm(formula = trails_b_z_score ~ fpn_participation_x, data = ya_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.8764 -0.7521 0.0559 0.7053 1.9656
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.291 1.435 1.597 0.1169
## fpn_participation_x -4.373 2.372 -1.844 0.0714 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.333 on 48 degrees of freedom
## (24 observations deleted due to missingness)
## Multiple R-squared: 0.06613, Adjusted R-squared: 0.04668
## F-statistic: 3.399 on 1 and 48 DF, p-value: 0.07141
summary(lm(trails_b_z_score ~ Group*fpn_participation_x, data = d)) #p = 0.0161
##
## Call:
## lm(formula = trails_b_z_score ~ Group * fpn_participation_x,
## data = d)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.8764 -0.8006 0.0762 0.8288 2.4810
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.291 1.387 1.652 0.10193
## GroupOlder Adults -6.400 2.642 -2.422 0.01741 *
## fpn_participation_x -4.373 2.292 -1.908 0.05956 .
## GroupOlder Adults:fpn_participation_x 11.479 4.209 2.728 0.00766 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.288 on 91 degrees of freedom
## (48 observations deleted due to missingness)
## Multiple R-squared: 0.1446, Adjusted R-squared: 0.1164
## F-statistic: 5.13 on 3 and 91 DF, p-value: 0.00253
alpha = 0.05
oa_cor <- select(oa_data, age, IS:RA, actamp:fact, actquot, matches("wb_|dmn_|fpn_"))
oa_cor <- oa_cor[complete.cases(oa_cor), ]
oa_mat <- cor(oa_cor)
oa_res <- cor.mtest(oa_mat, conf.level = (1-alpha))
corrplot(oa_mat, p.mat = oa_res$p, sig.level = alpha, insig = "blank", type = "upper")
oa_data %>%
select(age, IS:RA, actamp, actalph, actupmesor, fact, fpn_participation_x) %>%
melt(id.vars = "fpn_participation_x") %>%
ggplot() +
theme_minimal() +
geom_point(aes(x = value, y = fpn_participation_x)) +
facet_wrap (. ~ variable, scales = "free_x")
## Warning: Removed 318 rows containing missing values (geom_point).
oa_data %>%
select(age, IS:RA, actamp, actalph, actupmesor, fact, dmn_participation_x) %>%
melt(id.vars = "dmn_participation_x") %>%
ggplot() +
theme_minimal() +
geom_point(aes(x = value, y = dmn_participation_x)) +
facet_wrap (. ~ variable, scales = "free_x")
## Warning: Removed 318 rows containing missing values (geom_point).
ya_data %>%
select(age, IS:RA, actamp, actalph, actupmesor, fact, fpn_participation_x) %>%
melt(id.vars = "fpn_participation_x") %>%
ggplot() +
theme_minimal() +
geom_point(aes(x = value, y = fpn_participation_x)) +
facet_wrap (. ~ variable, scales = "free_x")
## Warning: Removed 232 rows containing missing values (geom_point).
ya_data %>%
select(age, IS:RA, actamp, actalph, actupmesor, fact, dmn_participation_x) %>%
melt(id.vars = "dmn_participation_x") %>%
ggplot() +
theme_minimal() +
geom_point(aes(x = value, y = dmn_participation_x)) +
facet_wrap (. ~ variable, scales = "free_x")
## Warning: Removed 232 rows containing missing values (geom_point).
library(corrr)
pcoef <- read_csv('~/Box/CogNeuroLab/Aging Decision Making R01/Analysis/rest/bct/participation_nodewise_r.csv')
## Parsed with column specification:
## cols(
## .default = col_double()
## )
## See spec(...) for full column specifications.
pcoef <- select(pcoef, record_id, matches("PFC"))
pcoef <- merge(pcoef, dplyr::select(d, record_id, vc_zscore, cvlt_ldelay_recall_zscore, cowat_zscore, ds_zscore, trails_b_z_score), by = 'record_id')
pcoef$ef_zscore <- (pcoef$trails_b_z_score + pcoef$ds_zscore )/2
pcoef$Group <- factor(ifelse(pcoef$record_id < 40000, 0, 1), labels = c("Young Adults", "Older Adults"))
oa_data <- filter(pcoef, record_id > 40000)
oa_data <- select(oa_data, -Group)
ya_data <- filter(pcoef, record_id < 40000)
ya_data <- select(ya_data, -Group, -cowat_zscore, -cvlt_ldelay_recall_zscore)
focus_oa <- oa_data %>%
na.omit() %>%
correlate(method = "spearman", use = "complete.obs") %>%
focus(vc_zscore, ds_zscore, trails_b_z_score, cvlt_ldelay_recall_zscore, cowat_zscore, ef_zscore)
##
## Correlation method: 'spearman'
## Missing treated using: 'complete.obs'
focus_ya <- ya_data %>%
correlate(method = "spearman", use = "complete.obs") %>%
focus(vc_zscore, ds_zscore, trails_b_z_score, ef_zscore)
##
## Correlation method: 'spearman'
## Missing treated using: 'complete.obs'
focus_oa.mlt <- melt(focus_oa, id.vars = 'rowname')
focus_ya.mlt <- melt(focus_ya, id.vars = 'rowname')
focus_cog <- merge(focus_ya.mlt, focus_oa.mlt, by = c("rowname", "variable"))
ggplot(data = na.omit(focus_oa.mlt[abs(focus_oa.mlt$value) > 0.35,]), aes(x = value, y = rowname)) +
geom_point(color = 'red') +
geom_point(data = drop_na(focus_ya.mlt[abs(focus_ya.mlt$value) > 0.35,]), color = 'blue') +
facet_grid( ~ variable, scales='fixed')
pcoef$PFC_mean <- rowMeans(select(pcoef, matches("PFC")))
pcoef %>%
select(matches("PFC")) %>%
select(matches("RH")) %>%
rowMeans() -> pcoef$R_PFC_mean
pcoef %>%
select(matches("PFC")) %>%
select(matches("LH")) %>%
rowMeans() -> pcoef$L_PFC_mean
sc_melt <- melt(select(pcoef, Group, R_PFC_mean, matches("zscore|z_score")) , id.vars = c("Group", "R_PFC_mean"))
sc_melt %>%
ggplot(aes(color = Group, group = Group)) +
geom_point(aes(x = R_PFC_mean, y = value, color = Group, group = Group)) +
stat_smooth(aes(x = R_PFC_mean, y = value, color = Group, group = Group), method = "lm") +
scale_color_manual(values = c("blue", "red")) +
ylab("z-score") +
facet_wrap(. ~ variable) + ylim(-2,2)
## Warning: Removed 151 rows containing non-finite values (stat_smooth).
## Warning: Removed 151 rows containing missing values (geom_point).
sc_melt <- melt(select(pcoef, Group, L_PFC_mean, matches("zscore|z_score")) , id.vars = c("Group", "L_PFC_mean"))
sc_melt %>%
ggplot(aes(color = Group, group = Group)) +
geom_point(aes(x = L_PFC_mean, y = value, color = Group, group = Group)) +
stat_smooth(aes(x = L_PFC_mean, y = value, color = Group, group = Group), method = "lm") +
scale_color_manual(values = c("blue", "red")) +
ylab("z-score") +
facet_wrap(. ~ variable) + ylim(-2,2)
## Warning: Removed 151 rows containing non-finite values (stat_smooth).
## Warning: Removed 151 rows containing missing values (geom_point).
sc_melt <- melt(select(pcoef, Group, PFC_mean, matches("zscore|z_score")) , id.vars = c("Group", "PFC_mean"))
sc_melt %>%
ggplot(aes(color = Group, group = Group)) +
geom_point(aes(x = PFC_mean, y = value, color = Group, group = Group)) +
stat_smooth(aes(x = PFC_mean, y = value, color = Group, group = Group), method = "lm") +
scale_color_manual(values = c("blue", "red")) +
ylab("z-score") +
facet_wrap(. ~ variable) + ylim(-2,2)
## Warning: Removed 151 rows containing non-finite values (stat_smooth).
## Warning: Removed 151 rows containing missing values (geom_point).